home *** CD-ROM | disk | FTP | other *** search
- /* Screen editor: prompt line module
- *
- * Module: ed7/ccc
- * Date: November 15, 1983
- * Changed: February 17, 1984
- */
-
- #include ed0
-
- /* define where things on top line will be displayed */
- #define xline 0 /* for line number */
- #define xcolumn 10 /* for column number */
- #define xmem 19 /* for memory available */
- #define xlodsav 32 /* for 'load save' file name */
- #define xmode 48 /* for mode of operation */
-
- /* data global to this module */
-
- /* Define the prompt line data */
- char pmtln[MAXLEN], /* mode */
- pmtfn[SYSFNMAX]; /* file name for load/save */
-
- /* put message on local device and
- * wait for response.
- */
- pmtmess(s1,s2) char *s1,*s2;
- { char x,y;
- /* save cursor */
- x = outgetx();
- y = outgety();
- outxy(0,0);
- /* make sure line is correct */
- outdelln();
- pmtline1();
- pmtcol1(x);
- /* output error message */
- fmtsout(s1,outgetx());
- fmtsout(s2,outgetx());
- /* wait for input from console */
- syscin();
- /* redraw prompt line */
- pmttop(x);
- /* restore cursor */
- outxy(x,y);
- }
-
- /* write new mode message on prompt line */
- pmtmode(s) char *s;
- { char x,y;
- /* save cursor */
- x = outgetx();
- y = outgety();
- /* redraw whole line */
- outxy(0,0);
- outdelln();
- pmtline1();
- pmtcol1(x);
- pmtmem();
- pmtfile1(pmtfn);
- pmtmode1(s);
- /* restore cursor */
- outxy(x,y);
- }
-
- /* update file name on prompt line */
- pmtfile(s) char *s;
- { char x,y;
- /* save cursor on entry */
- x = outgetx();
- y = outgety();
- /* redraw whole line */
- outxy(0,0);
- outdelln();
- pmtline1();
- pmtcol1(x);
- pmtmem();
- pmtfile1(s);
- pmtmode1(pmtln);
- /* restore cursor */
- outxy(x,y);
- }
-
- /* change mode on prompt line to edit: */
- pmtedit()
- { pmtmode("edit:"); }
-
- /* update line and column numbers on prompt line */
- pmtline()
- { char x,y;
- /* save cursor on entry */
- x = outgetx();
- y = outgety();
- /* redraw whole line */
- pmttop(x);
- /* restore cursor */
- outxy(x,y);
- }
-
- /* update just the column number on prompt line */
- pmtcol()
- { char x,y;
- /* save cursor on entry */
- x = outgetx();
- y = outgety();
- /* update column number */
- pmtcol1(x);
- /* update cursor */
- outxy(x,y);
- }
-
- /* update mode. call getcmnd() to write on prompt line */
- pmtcmnd(mode,buffer) char *mode,*buffer;
- { char x,y;
- /* save cursor */
- x = outgetx();
- y = outgety();
- pmtmode1(mode);
- /* user types command on prompt line */
- getcmnd(buffer,outgetx());
- /* restore cursor */
- outxy(x,y);
- }
-
- /* update and print mode */
- pmtmode1(s) char *s;
- { int i;
- outxy(xmode,0);
- fmtsout(s,xmode);
- i = 0;
- while (pmtln[i++] = *s++)
- ;
- }
-
- /* update the amount of memory available */
- pmtmem()
- { int mem;
- char x,y;
- x = outgetx();
- y = outgety();
- mem = buffree();
- outxy(xmem,0);
- fmtsout("lns: ",xmem);
- putdec(mem,6);
- outxy(x,y);
- }
-
- /* print the file name on the prompt line */
- pmtfile1(s) char *s;
- { int i;
- outxy(xlodsav,0);
- if (*s == EOS)
- fmtsout("no file",xlodsav);
- else
- fmtsout(s,xlodsav);
- i = 0;
- while (pmtfn[i++] = *s++)
- ;
- }
-
- /* print the line number on the prompt line */
- pmtline1()
- { outxy(xline,0);
- fmtsout("ln: ",xline);
- putdec(bufln(),5);
- }
-
- /* print column number of the cursor */
- pmtcol1(x) char x;
- { outxy(xcolumn,0);
- fmtsout("col: ",xcolumn);
- putdec(x+1,3);
- }
-
- /* redraw prompt line */
- pmttop(x) char x;
- { outxy(0,0);
- outdelln();
- pmtline1();
- pmtcol1(x);
- pmtmem();
- pmtfile1(pmtfn);
- pmtmode1(pmtln);
- }
-
- /* update just the column number on prompt line */
- pmtlnx()
- { char x,y;
- /* save cursor on entry */
- x = outgetx();
- y = outgety();
- /* update column number */
- pmtline1();
- pmtcol1(x);
- /* update cursor */
- outxy(x,y);
- }
-
- /* end module ed7/ccc */
-